package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_coupon")
public class FoxCardCouponConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "优惠券id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "类型")
    private int type;
    @FieldTypeAnnotation(desc = "参数")
    private String param;
    @FieldTypeAnnotation(desc = "解锁前置")
    private int unlockPremise;
    @FieldTypeAnnotation(desc = "名称")
    private String name;
    @FieldTypeAnnotation(desc = "描述")
    private String desc;
    @FieldTypeAnnotation(desc = "权重（商店用）")
    private int weight;
    @FieldTypeAnnotation(desc = "价格")
    private int gold;
    @FieldTypeAnnotation(desc = "效果表现参数")
    private String showParams;

    private List<Integer> paramList = new ArrayList<>();

    public FoxCardCouponConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.type = rs.getInt("type");
        this.param = rs.getString("param");
        this.unlockPremise = rs.getInt("unlockPremise");
        this.name = rs.getString("name");
        this.desc = rs.getString("desc");
        this.weight = rs.getInt("weight");
        this.gold = rs.getInt("gold");
        this.showParams = rs.getString("showParams");

        this.paramList = StringUtils.stringToIntegerList(param, "\\|");
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public int getType() {
        return type;
    }

    public String getParam() {
        return param;
    }

    public int getUnlockPremise() {
        return unlockPremise;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public int getWeight() {
        return weight;
    }

    public List<Integer> getParamList() {
        return paramList;
    }

    public int getGold() {
        return gold;
    }

    public String getShowParams() {
        return showParams;
    }
}